<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
	<title>个人注册</title>


	<link rel="stylesheet" type="text/css" href="http://user.bnz.com/static/user/css/webbase.css" />
	<link rel="stylesheet" type="text/css" href="http://user.bnz.com/static/user/css/pages-register.css" />
</head>

<body>
<div class="register py-container ">
	<!--head-->
	<div class="logoArea">
		<a href="http://user.bnz.com/static/user/" class="logo"></a>
	</div>
	<!--register-->
	<div class="registerArea">
		<div th:if="${username == null}">
			<h3>注册新用户<span class="go">我有账号，去
				<a href="http://user.bnz.com/static/user/login.html" target="_blank">登陆</a></span>
			</h3>
		</div>
		<div th:if="${username != null}">
			当前用户：[[${username}]]
		</div>
		<div class="info">
			<form class="sui-form form-horizontal" action="/user/add" method="post">
				<div class="control-group">
					<label class="control-label">用户名：</label>
					<div class="controls">
						<input type="text" name="username" placeholder="请输入你的用户名" class="input-xfat input-xlarge">
					</div>
				</div>
				<div class="control-group">
					<label for="inputPassword" class="control-label">登录密码：</label>
					<div class="controls">
						<input type="password" name="password" id="password" placeholder="设置登录密码" class="input-xfat input-xlarge">
					</div>
				</div>
				<div class="control-group">
					<label for="inputPassword" class="control-label">确认密码：</label>
					<div class="controls">
						<input type="password" name="repassword" id="repassword" placeholder="再次确认密码" class="input-xfat input-xlarge">
					</div>
				</div>

				<div class="control-group">
					<label class="control-label">手机号：</label>
					<div class="controls">
						<input type="text" id="phone" name="phone" placeholder="请输入你的手机号" class="input-xfat input-xlarge">
					</div>
				</div>
				<div class="control-group">
					<label for="inputPassword" class="control-label">短信验证码：</label>
					<div class="controls">
						<input type="text" placeholder="短信验证码" name="code" class="input-xfat input-xlarge">
						<a href="#" onclick="sendSms()">获取短信验证码</a>
					</div>
				</div>

				<div class="control-group">
					<label for="inputPassword" class="control-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
					<div class="controls">
						<input name="m1" type="checkbox" value="2" checked=""><span>同意协议并注册《泽易购用户协议》</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label"></label>
					<div class="controls btn-reg">
						<a class="sui-btn btn-block btn-xlarge btn-danger" href="javascript:;" onclick="saveUser()" target="_blank">完成注册</a>
					</div>
				</div>
			</form>
			<div class="clearfix"></div>
		</div>
	</div>
	<!--foot-->
	<div class="py-container copyright">
		<ul>
			<li>关于我们</li>
			<li>联系我们</li>
			<li>联系客服</li>
			<li>商家入驻</li>
			<li>营销中心</li>
			<li>手机泽易购</li>
			<li>销售联盟</li>
			<li>泽易购社区</li>
		</ul>
		<p>地址：深圳市大冲国际</p>
	</div>
</div>
</div>


<script type="text/javascript" src="http://user.bnz.com/static/user/js/plugins/jquery/jquery.min.js"></script>
<script type="text/javascript" src="http://user.bnz.com/static/user/js/plugins/jquery.easing/jquery.easing.min.js"></script>
<script type="text/javascript" src="http://user.bnz.com/static/user/js/plugins/sui/sui.min.js"></script>
<script type="text/javascript" src="http://user.bnz.com/static/user/js/plugins/jquery-placeholder/jquery.placeholder.min.js"></script>
<script type="text/javascript" src="http://user.bnz.com/static/user/js/pages/register.js"></script>
</body>

</html>

<script>
	//1. 发送手机号，在后台生成验证码
	function sendSms(){
		//1.1 获取手机号
		let phone = $("#phone").val()
		//1.2 跳转到后台，生成验证码
		location.href = `/user/sendSms/${phone}`
	}
	//2. 保存用户
	function saveUser(){
		//2.1 数据校验。。。
		//2.2 提交数据到后台
		document.forms[0].submit();
	}
</script>